﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace BLL.BusinessClasses
{
    public static class Encryption
    {
        public static string GetMD5Hash(string Input)
        {
            return ConvertToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(Input)));
        }

        private static string ConvertToString(byte[] Input)
        {
            int i;
            StringBuilder Output = new StringBuilder(Input.Length);
            for (i = 0; i < Input.Length - 1; i++)
            {
                Output.Append(Input[i].ToString("X2"));
            }
            return Output.ToString();
        }

    }
}
